<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>学习中心</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="/resources/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="/resources/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="/resources/css/amazeui.min.css" />
    <script src="/resources/js/jquery.min.js"></script>
    <style type="text/css">
    html,body{
        height: 100%;
    }
    .active{
        background-color:#dddddd;
        color:red;
    }
    </style>

</head>
<body>
<div style="background-color:#82a6f5;height:7%;">
    <a href="/s/study" target="_parent">
        <button style="background-color:rgba(255,255,255,0);border-radius:25px;border-color:white;margin-top:7px;margin-left:12px;">
            <b style="color:white;"><</b>
        </button>
    </a>
</div>
<div style="height: 93%">
    <input type="hidden" id="rebinId" value="${rebinId}">
    <c:forEach items="${pageInfo.list}" var="a" varStatus="i">
        <div>
            <span>${a.rname}</span>
        </div>
        <div style="position:relative;font-size: 8px">
            <span>${a.reinstruct}</span>
        </div>
        <div>
            <c:choose>
                <c:when test="${a.retype == '视频'}">
                    <video width="100%" height="240" src="${a.repath}" controls></video>
                </c:when>
                <c:when test="${a.retype == '图片'}">
                    <img width="100%" height="240" src="${a.repath}" alt="这里是图片">
                </c:when>
            </c:choose>
        </div>
        <div class="am-g" style="margin:10px;">
            <div class="am-u-sm-7">
                <textarea id="study${i.index}" style="font-size:20px;" rows="1" cols="25" placeholder="请在此输入学习心得"></textarea>
            </div>
            <div class="am-u-sm-4">
                <button onclick="submit_xd('study${i.index}')" class="am-btn am-btn-success am-radius">提交</button>
            </div>
        </div>
    </c:forEach>
</div>
</body>
<script>
    $("#study").on("click",function () {
        $(this).attr("rows",5);
    });
    $("#study").on("blur",function () {
        $(this).attr("rows",1);
        var content = $("#study").val();
    });
    function submit_xd(domid) {
        var id = '#'+domid;
        var rebinId = $('#rebinId').val();
        var content=$(id).val();
        var formData=new FormData();
        formData.append("reserve1",rebinId);
        formData.append("content",content);
        $.ajax({
            type: "POST",
            cache: false,
            url:"/sub/submit",
            data:formData,
            processData: false,
            contentType: false
        }).done(
            function (res) {
                if (res.emp=="true"){
                    alert("提交成功");
                }else {
                    alert("提交失败");
                }
            }
        ).error(function () {
            alert("启用失败");
        });
    }
</script>
</html>
